
var _mCurrentIndex=0;
function ChooseMobile(index){
	if(!index){index=0;}
	var p = pages[index];
    _mCurrentIndex = index;

	var xml = GeneratePage(pages[index],'MobileStage');
	$(".MobileStage").html(xml); 
	UpdateImageRadius('MobileStage',0.95);
    $("#MajorPageMobileStageloading").show();
    //$("#MajorPageMobileStageloading").css("opacity",0.99);
    setTimeout(function(){
        $("#MajorPageMobileStageloading").hide();
    },300);
    if(!p.upper){
        SetupAutoHideTopbar('MobileStage');
    }
   
}
function MobileEvent_SelectCategory(){
    var names=[];
    for(let x of nav.items){
        names.push(x.title);
    }
    MobileSelectCategory({
        title:'请选择一个分类',
        items:names,
        func:function(name){
            _mCurrentIndex = 0;
            var pi = GetProjectIndexByCategory(name);
            console.log(pi);
            console.log(name);
            if(pi>=0){
                OnSwitchProject(pi);
                ChooseMobile(0);
            }
        }
    });
    //$(".MobileCategoryList").css("display","flex");
}
function MobileEvent_Contract(){
    MobileMessageDialog({
        title:'联系方式',
        text:'用电脑打开当前链接，可以查看更多信息。欢迎添加【QQ: 3667386867】进行沟通',
        buttons:['关闭']
        /*
        buttons:[{text:'关闭'},{name:'复制QQ号',color:'blue',callback:function(){
            console.log("copy string");
            CopyTextToClipboard("O232111xx");
        }}]*/

    });
}
function MobileEvent_Prev(){
    var i = _mCurrentIndex-1;
    if(i<0){i=pages.length-1;}
    ChooseMobile(i);
}
function MobileEvent_Next(){
    var i = _mCurrentIndex+1;
    var n = pages.length;
    if(i>=n){i=0;}
    ChooseMobile(i);
}
function InitMobile(){
	//$("body").css("background","linear-gradient(to bottom,#000 0%,#222 100%)");
	ChooseMobile(0);
   
   
   
}